package com.aimusic.controller;


import com.aimusic.domain.Result;
import com.aimusic.domain.po.UserProfile;
import com.aimusic.service.IUserProfileService;
import com.aimusic.utils.CurrentHolder;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户表（手机号登录核心表） 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-09-25
 */
@RestController
@RequestMapping("/api/user")
@RequiredArgsConstructor
public class UserController {
    private final IUserProfileService userProfileService;

    /**
     * 获取用户信息
     * @return
     */
    @GetMapping("/info")
    public Result getUserInfo(){
        UserProfile userProfile = userProfileService.getUserInfo();
        return Result.success(userProfile);
    }

    /**
     * 更新用户信息
     * @param userProfile
     * @return
     */
    @PostMapping("/update-profile")
    public Result updateProfile(@RequestBody UserProfile userProfile){
        userProfileService.updateProfile(userProfile);
        return Result.success();
    }
}
